package practice01;

import java.util.Locale;
import java.util.Random;
import java.util.Scanner;

public class YanZheng {
    public static void main(String[] args) {
        String name = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
        int num = name.length();
        Random random = new Random();                    //创建随机数对象random
        StringBuilder string = new StringBuilder();      //创建一个StringBuilder对象string
        Scanner scanner = new Scanner(System.in);
        for (int i=0;i<4;i++){
            int c = random.nextInt(num);
            string.append(name.charAt(c));
        }
        String string1 = string.toString();
        string1 = string1.toUpperCase(Locale.ROOT);
        System.out.println(string1);
        String name1 = scanner.nextLine();
        if (string1.equalsIgnoreCase(name1)){
            System.out.println("正确");
        }else {
            System.out.println("错误");
        }
    }
}
